﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;

namespace BeardCoder.Data.Framework
{
    public interface IRepository<T>
    {
        IDbContext DbContext { get; }
        IUnitOfWork UnitOfWork { get; }

        void Add(T entity);
        void Update(T entity);
        void Delete(T entity);
        void Delete(Expression<Func<T, bool>> where);
        T Get(object id);
        T Get(Expression<Func<T, bool>> where);
        T Load(object id);
        IEnumerable<T> List();
        IEnumerable<T> List(Expression<Func<T, bool>> where);
        IQueryable<T> GetQueryable();
        IQueryable<T> GetQueryable(Expression<Func<T, bool>> where);
        IQueryable<K> GetQueryable<K>();
        long Count();
        long Count(Expression<Func<T, bool>> where);

        int SaveChanges();
        bool IsModified(object entity);
    }
}
